<template>
{{#if ctrl.psSysPFPlugin}}
    {{> @macro/plugins/widget/widget-use.hbs appPlugin=ctrl.psSysPFPlugin}}
{{else}}
  <AppExpBar 
    :class="classNames">
{{#and ctrl.parent ctrl.parent.enableQuickGroup ctrl.parent.quickGroupPSCodeList}}
    <template #quickGroup>
        <div class="quick-group-container">
            {{> @macro/common/quick-group.hbs}}
        </div>
    </template>
{{/and}}
{{#if ctrl.enableSearch}}
    <template #quickSearch>
        {{> @macro/common/quick-search.hbs}}
    </template>
{{/if}}
    <template #default>
{{#ctrl.ctrls}}
  {{#eq controlType "LIST"}}
      <{{codeName}}List
        name="{{ctrl.xDataControlName}}"
        :actions="{
          createAction: '{{#and createPSControlAction createPSControlAction.psAppDEMethod}}{{createPSControlAction.psAppDEMethod.codeName}}{{else}}Create{{/and}}',
          fetchAction: '{{#and fetchPSControlAction fetchPSControlAction.psAppDEMethod}}{{fetchPSControlAction.psAppDEMethod.codeName}}{{else}}FetchDefault{{/and}}',
          removeAction: '{{#and removePSControlAction removePSControlAction.psAppDEMethod}}{{removePSControlAction.psAppDEMethod.codeName}}{{else}}Remove{{/and}}',
          updateAction: '{{#and updatePSControlAction updatePSControlAction.psAppDEMethod}}{{updatePSControlAction.psAppDEMethod.codeName}}{{else}}Update{{/and}}'
        }"
        :context="context"
        :viewParams="viewParams"
        :openView="openView"
        :newView="newView"
        listMode="exp"
        :closeView="closeView"
        :selectFirstDefault="true"
        :singleSelect="true"
        :pViewCtx="store.viewCtx"
        @ctrl-init="(name, ability) => { handleCtrlInit(controller, name, ability) }"
        @ctrl-action="(name, action, data) => { handleCtrlAction(controller, name, action, data) }"
        @ctrl-destroy="(name, data) => { handleCtrlDestroy(controller, name, data) }"
      ></{{codeName}}List>
  {{/eq}}
{{/ctrl.ctrls}}
    </template>
  </AppExpBar>
{{/if}}
</template>

// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@LISTEXPBAR}}-list-exp-bar/\{{ctrls@LISTEXPBAR}}-list-exp-bar.vue.hbs生成
<script setup lang="ts">
{{> @macro/plugins/widget/widget-import.hbs ctrl=ctrl}}
import { AppExpBar } from '@components/widgets/exp-bar';
{{#ctrl.ctrls}}
  {{#eq controlType "LIST"}}
import {{codeName}}List from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-list/{{spinalCase codeName}}-list.vue';
  {{/eq}}
  {{#eq controlType 'TOOLBAR'}}
import { AppToolbar } from '@components/widgets/toolbar';
  {{/eq}}
{{/ctrl.ctrls}}
import { ListExpBarActionType, ListExpBarController, IContext, IListExpBarAbility, IListExpBarControllerParams, IListExpBarStore, IParam, IListExpBarController, ILoadingHelper, createUUID, IViewCtx } from '@/core';
import {
  useNavParamsBind,
  useEventBind,
  getExpBarClassNames,
{{#ctrl.ctrls}}
  {{#eq controlType 'TOOLBAR'}}
  handleToolbarItemClick,
  {{/eq}}
{{/ctrl.ctrls}}
{{#and ctrl.parent ctrl.parent.enableQuickGroup ctrl.parent.quickGroupPSCodeList}}
  handleQuickGroupValueChange,
{{/and}}
{{#if ctrl.enableSearch}}
  handleQuickSearch,
{{/if}}
  handleCtrlInit,
  handleCtrlAction,
  handleCtrlDestroy
} from '@/hooks/use-ctrl';
import { model{{#ctrl.ctrls}}{{#eq controlType 'TOOLBAR'}}, toolbarItems{{/eq}}{{/ctrl.ctrls}} } from './{{spinalCase ctrl.codeName}}-list-exp-bar-model';

{{> @macro/widgets/ctrl/ctrl-props.hbs
    props="openView?: Function;
    newView?: Function;
    "
}}

{{> @macro/common/emit.hbs name="ctrl" actionType="ListExpBarActionType" ability="IListExpBarAbility"}}

const classNames = computed(() => {
  return getExpBarClassNames(model, props);
});

const controlID = createUUID();

const params: IListExpBarControllerParams<ListExpBarActionType, IListExpBarAbility> = {
  name: props.name,
  model,
  evt,
  controlID,
  openView: props.openView,
  newView: props.newView,
  closeView: props.closeView,
  pLoadingHelper: props.pLoadingHelper,
  handler: (data: IListExpBarStore) => { return reactive(data); }
};
// 列表导航控制器
const controller: IListExpBarController<IListExpBarStore, IListExpBarAbility> = new ListExpBarController(params);
useNavParamsBind(controller, props);

const store: IListExpBarStore = controller.getStore();

onMounted(() => {
  controller.ctrlMounted();
});
onUnmounted(() => {
  controller.ctrlDestroy();
})
</script>